#include "Exception.h"

CException::CException(int n_ErrorNo, const char * n_ErrorMsg, const char * n_FileName, int n_LineNo){
	m_ErrorNo = n_ErrorNo;
	if (n_ErrorMsg)
		m_ErrorMsg = n_ErrorMsg;
	if (n_FileName)
		m_FileName = n_FileName;
	m_LineNo = n_LineNo;
}

CException::CException(const char * n_ErrorMsg, const char * n_FileName, int n_LineNo){
	m_ErrorNo = EMPTY_ERROR_NO;
	if (n_ErrorMsg)
		m_ErrorMsg = n_ErrorMsg;
	if (n_FileName)
		m_FileName = n_FileName;
	m_LineNo = n_LineNo;
}

CException::CException(const CException& n_Src)
{
	m_ErrorNo = n_Src.m_ErrorNo;
	m_ErrorMsg = n_Src.m_ErrorMsg;
	m_FileName = n_Src.m_FileName;
	m_LineNo = n_Src.m_LineNo;
}

string CException::make_Log_msg() const
{
	string strText;

	if (m_ErrorNo != EMPTY_ERROR_NO)
		strText = "ErrorNo: " + IntToStr(m_ErrorNo) + "\n";

	if (!m_FileName.empty() && m_LineNo != EMPTY_LINE_NO)
		strText = strText + "FileName: " + m_FileName + "\nLineNo: " + IntToStr(m_LineNo) + "\nErrorMsg: " + m_ErrorMsg;

	return strText;
}

